class Solution {
public:
    string path;
    string mp[10] = {
            "", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"
        };
    void dfs(string &digits, int k, vector<string> &result) {
        if (digits.size() == 0) return ;
        if (k == digits.size()) {
            result.push_back(path);
            return ;
        }
        string str = mp[digits[k] - '0'];
        for (int i = 0; i < str.size(); i++) {
            path.push_back(str[i]);
            dfs(digits, k + 1, result);
            path.pop_back();
        }
        return ;
    }
    vector<string> letterCombinations(string digits) {
        vector<string> result;
        dfs(digits, 0, result);
        return result;
    }
};
